<template>
  <el-table :data="orderList" style="width: 100%;padding-top: 15px;">
    <el-table-column label="客户" min-width="200">
      <template slot-scope="scope">
        {{ scope.row.username }}
      </template>
    </el-table-column>
    <el-table-column label="价格" width="250" align="center">
      <template slot-scope="scope">
        ¥{{ scope.row.price }}
      </template>
    </el-table-column>
    <el-table-column label="状态" width="200" align="center">
      <template slot-scope="{row}">
        <el-tag :type="statusFilter(row.status)">
          {{ row.status }}
        </el-tag>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
import { orders } from './data/orderList.js'

export default {
  data() {
    return {
      orderList: null
    }
  },
  created() {
    this.orderList = orders
  },
  methods: {
    statusFilter(status) {
      const statusMap = {
        success: 'success',
        pending: 'danger'
      }
      return statusMap[status]
    }
  }
}
</script>
